//
//  BalanceView.m
//  JackDeve
//
//  Created by Agensn on 2017/5/11.
//  Copyright © 2017年 wkq. All rights reserved.
//

#import "BalanceView.h"

@implementation BalanceView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self == [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor whiteColor];
        [self addSubview:self.img];
        self.img.sd_layout.centerXEqualToView(self).widthIs(150).heightIs(150).topSpaceToView(self, 100);
        [BalanceModel shareMo];
        
        [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(price:) name:@"yue" object:nil];
        [self addSubview:self.priceLab];
        self.priceLab.sd_layout.centerXEqualToView(self).topSpaceToView(self.img, 30).widthIs(self.frame.size.width).heightIs(40);

    }
    return self;
}

-(void)price:(NSNotification *)obj{
    NSString *str = obj.object;
    self.priceLab.text = [NSString stringWithFormat:@"¥%@",str];
}

-(UIImageView *)img{
    if (!_img) {
        _img = [[UIImageView alloc]init];
        _img.image = [UIImage imageNamed:@"w-y-余额支付"];
    }
    return _img;
}
-(UILabel *)priceLab{
    if (!_priceLab) {
        _priceLab = [[UILabel alloc]init];
//        _priceLab.text = @"1000000";
        
        _priceLab.textAlignment = NSTextAlignmentCenter;
        _priceLab.font = [UIFont systemFontOfSize:50];
        _priceLab.font = [UIFont boldSystemFontOfSize:50];
        
    }
    return _priceLab;
}


@end
